package org.texteasy.helpers;

public enum MessageEditorStates {

	INITIAL_STATE("InitialState"),
	NEW_MESSAGE_LOADING("NewMessageLoading"),
	NEW_MESSAGE_WITH_NO_TEXT("NewMessageWithNoText"),
	PAUSED_NEW_MESSAGE_WITH_TEXT("PausedNewMessageWithText"),
	NEW_MESSAGE_WITH_TEXT("NewMessageWithText"),
	WAITING_FOR_SERVICE_RECEIPT("WaitingForServiceReceipt"),
	PAUSED_WAITING_FOR_SERVICE_RECEIPT("PausedWaitingForServiceReceipt"),
	IN_PROGRESS_MESSSAGE("InProgressMessage"),
	SENT_MESSAGE("SentMessage"),
	DISCARDED_MESSAGE("DiscardedMessage");
	
	
	private String name;
	
	MessageEditorStates(String name){
		this.name = name;
	}
	
	public String getName(){
		return name;
	}
	
	public static MessageEditorStates getMessageEditorStateFromName(String name){
		
		if(INITIAL_STATE.getName().equalsIgnoreCase(name)){
			return INITIAL_STATE;
		}else if(NEW_MESSAGE_WITH_NO_TEXT.getName().equalsIgnoreCase(name)){
			return NEW_MESSAGE_WITH_NO_TEXT;
		}else if(NEW_MESSAGE_WITH_TEXT.getName().equalsIgnoreCase(name)){
			return NEW_MESSAGE_WITH_TEXT;
		}else if(IN_PROGRESS_MESSSAGE.getName().equalsIgnoreCase(name)){
			return IN_PROGRESS_MESSSAGE;
		}else if(SENT_MESSAGE.getName().equalsIgnoreCase(name)){
			return SENT_MESSAGE;
		}else if(DISCARDED_MESSAGE.getName().equalsIgnoreCase(name)){
			return DISCARDED_MESSAGE;
		}else if(NEW_MESSAGE_LOADING.getName().equalsIgnoreCase(name)){
			return NEW_MESSAGE_LOADING;
		}else if(PAUSED_NEW_MESSAGE_WITH_TEXT.getName().equalsIgnoreCase(name)){
			return PAUSED_NEW_MESSAGE_WITH_TEXT;
		}else if(WAITING_FOR_SERVICE_RECEIPT.getName().equalsIgnoreCase(name)){
			return WAITING_FOR_SERVICE_RECEIPT;
		}else{
			return null;
		}
		
	}
}
